package com.laogao.exception;

import com.laogao.enums.AppHttpCodeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 自定义异常
 * @author laogao
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class AdxException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    private int code;
    private String msg;

    public AdxException(String msg) {
        super(msg);
        this.code = AppHttpCodeEnum.SYSTEM_ERROR.getCode();
        this.msg = msg;
    }

    public AdxException(AppHttpCodeEnum errorCodeEnum) {
        super(errorCodeEnum.getMsg());
        this.code = errorCodeEnum.getCode();
        this.msg = errorCodeEnum.getMsg();
    }
}